package com.ywy.dao;

import com.ywy.entity.Res;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * 资源Repository接口
 *
 * @author ywy
 * @date 2022/8/17 12:13
 */
public interface ResDao extends JpaRepository<Res, Integer>, JpaSpecificationExecutor<Res> {
    /**
     * 失效链接更新状态
     * @param id
     * @return
     */
    @Modifying
    @Query(value = "update sys_res set is_useful=false where id=?1", nativeQuery = true)
    int invalid(Integer id);
}
